import java.util.HashMap;
import java.util.Map;

/*
 * Class to take the numbers 0 to 1 and covert that into morse code
 * string.
 */
public class NumberToMorseCode
{
    private Map<Integer, String> morseMap = new HashMap<>();
    
    public static void main(String[] args)
    {
        NumberToMorseCode numToMorse = new NumberToMorseCode();
        numToMorse.covertStringToMorseCode("0");
        numToMorse.covertStringToMorseCode("9");
        numToMorse.covertStringToMorseCode("5");
        numToMorse.covertStringToMorseCode("3");
    }
    
    public NumberToMorseCode() {
        initMorseMap();
    }
    
    private void covertStringToMorseCode(String string) {
        
        if(string != null && !string.isEmpty()) {
            String morseCode = morseMap.get(Integer.parseInt(string));
            System.out.println("Morse Code for " + string + ": " + morseCode);
        } else {
            System.out.println("Invalid number string");
        }
    }

    private void initMorseMap()
    {
        morseMap.put(0, "- - - - -");
        morseMap.put(1, ". - - - -");
        morseMap.put(2, ". . - - -");
        morseMap.put(3, ". . . - -");
        morseMap.put(4, ". . . . -");
        morseMap.put(5, ". . . . .");
        morseMap.put(6, "- . . . .");
        morseMap.put(7, "- - . . .");
        morseMap.put(8, "- - - . .");
        morseMap.put(9, "- - - - .");
    }

}
